package MyThread_demo.zidingyixianchengchi;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * @author ChenYongHao
 * @date 2023/5/4 16:37
 * @desc 设计的自定义线程池进行测试。
 */
@Slf4j
public class ThreadPoolTest {
    public static void main(String[] args) {
        ThreadPool threadPool = new ThreadPool(5, 1000L, TimeUnit.MILLISECONDS, 10);

        for (int i = 0; i < 10; i++) {
            int info = i;
            threadPool.execute(() -> {
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                log.info("{}", info);
            });
        }
    }
}

